Conventionally, a data transfer control device with a triple-buffer configuration is known. For example, Patent Document 1 introduces a data buffering device configured in such a way that the buffer in which the most recent data is written can be referenced by priority. FIG. 10 is a diagram showing the configuration of the data buffering device described in Patent Document 1. In this configuration, three physical buffers, 222, 224, and 226 are used as any one of the write buffer, read buffer, and storage buffer based on the information stored in a buffer information register.
FIG. 11 is a flowchart showing the buffer switching algorithm described in Patent Document 1. The flag in a buffer switching request register 214 is set to 1 when a data supply unit 100 has written data, and the flag in a buffer switching inhibition register 216 is set to 1 while data is being read by a data reference unit 110. When a buffer switching request is generated, the device checks the flag in the buffer switching inhibition register 216 (step S12). If the flag in the buffer switching inhibition register 216 is 0, the flag indicates that the read buffer is not used. In this case, the read buffer and the write buffer in which the most recent data is written are exchanged (step S14).
On the other hand, if the flag in the buffer switching inhibition register 216 is 1 in step S12 described above, the flag indicates that the read buffer is being used. In this case, the storage buffer and the write buffer area exchanged. After that, a storage buffer effective flag 215 is set to 1 (step S16) to indicate that data more recent than that in the current read buffer is stored in the storage buffer.
If the buffer switching inhibition register 216 is changed to 0 in step S10 described above, the flag indicates that the data reference unit 110 has finished reading data. Therefore, if the storage buffer effective flag 215 is 1 and data is stored in the storage buffer, the read buffer and the storage buffer are exchanged (step S20). If the storage buffer effective flag 215 is 0 and data is not stored in the storage buffer, the current read buffer stores the most recent data and therefore the buffers are not exchanged (return to step S10).
[Patent Document 1]
Japanese Patent Kokai Publication JP-P2001-282650A